package org.cardcopier.file;

import java.io.File;
import java.util.List;

import junit.framework.TestCase;

public class CaseSensitiveFileLocationTest extends TestCase {

	public void testCanListFilesInLocation() {
		FileLocation location = new CaseInsensitiveFileLocation(new File("java/src/org/cardcopier"), new String[] { "java" });
		List<File> files = location.getFiles();
		assertTrue(files.size() > 0);
	}

	public void testCanListFilesForExtensionInWrongCase() {
		FileLocation location = new CaseInsensitiveFileLocation(new File("java/src/org/cardcopier"), new String[] { "JAVA" });
		List<File> files = location.getFiles();
		assertTrue(files.size() > 0);
	}

	public void testCanListFilesInSubDirsInLocation() {
		FileLocation location = new CaseInsensitiveFileLocation(new File("java/src/"), new String[] { "java" });
		List<File> files = location.getFiles();
		assertTrue(files.size() > 0);
	}

	public void testReturnsTrueIfFileExists() {
		FileLocation location = new CaseInsensitiveFileLocation(new File("java/src/org/cardcopier"), new String[] { "java" });
		assertTrue(location.containsFile(new File("FileLocation.java")));
	}

	public void testReturnsTrueIfFileDoesNotMatchCase() {
		FileLocation location = new CaseInsensitiveFileLocation(new File("java/src/org/cardcopier"), new String[] { "java" });
		assertTrue(location.containsFile(new File("filelocation.JAVA")));
	}

}
